# Normalize languages, some places/distros screw us up in /etc/profile,
# so in case the user did select a language
if [ -n "$GDM_LANG" ]; then
LANG="$GDM_LANG"
export LANG
if [ -n "$LC_ALL" ]; then
if [ "$LC_ALL" != "$LANG" ]; then
LC_ALL="$LANG"
fi
else
unset LC_ALL
fi
if [ -n "$LANGUAGE" ]; then
if [ "$LANGUAGE" != "$LANG" ]; then
LANGUAGE="$LANG"
fi
else
unset LANGUAGE
fi
if [ -n "$LINGUAS" ]; then
if [ "$LINGUAS" != "$LANG" ]; then
LINGUAS="$LANG"
fi
else
unset LINGUAS
fi
fi
# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for i in /etc/X11/xinit/xinitrc.d/* ; do
if [ -x "$i" ]; then
. "$i"
fi
done
fi
# run /etc/X11/Xsession.d/
OPTIONFILE=/etc/X11/Xsession.options
if [ -d /etc/X11/Xsession.d ]; then
for i in `ls /etc/X11/Xsession.d/` ; do
if [ -r "/etc/X11/Xsession.d/$i" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
. "/etc/X11/Xsession.d/$i"
fi
done
fi
if [ "x$command" = "xcustom" ] ; then
if [ -x "$HOME/.xsession" ]; then
command="$HOME/.xsession"
else
echo "$0: Cannot find ~/.xsession will try the default session"
command="default"
fi
fi
if [ "x$command" = "xdefault" ] ; then
if [ -x "$HOME/.Xclients" ]; then
command="$HOME/.Xclients"
elif [ -x /etc/X11/xinit/Xclients ]; then
command="/etc/X11/xinit/Xclients"
elif [ -x /etc/X11/Xclients ]; then
command="/etc/X11/Xclients"
else
if [ -n "$zenity" ] ; then
disptext=`gettextfunc "System has no Xclients file, so starting a failsafe xterm session. Windows will have focus only if the mouse pointer is above them. To get out of this mode type 'exit' in the window."`
"$zenity" --info --text "$disptext"
else
echo "$0: Cannot find Xclients"
fi
exec xterm -geometry 80x24+0+0
fi
fi
# add ssh-agent if found
sshagent="`gdmwhich ssh-agent`"
if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
command="$sshagent -- $command"
elif [ -z "$sshagent" ] ; then
echo "$0: ssh-agent not found!"
fi
echo "$0: Setup done, will execute: $command"
eval exec $command
echo "$0: Executing $command failed, will run xterm"
if [ -n "$zenity" ] ; then
disptext=`gettextfunc "Failed to start the session, so starting a failsafe xterm session. Windows will have focus only if the mouse pointer is above them. To get out of this mode type 'exit' in the window."`